package com.jy.adscm.security.utils;


import com.jy.adscm.bean.system.JyUser;

import java.util.Date;
import java.util.UUID;

/**
 * @author yyy
 * @ClassName Token
 * @Description 存储用户登录的信息
 * @date 2018/7/26 17:05
 */
public class Token {
    private JyUser user;//登录用户
    private String tokenId;//tokenID
    private Date loginTime;//登录时间
    //    private Date overdueTime;//登录过期时间
    private String loginIP;//登录IP

    public Token() {
        initTokenId();
    }

    public Token(JyUser user, Date loginTime, String loginIP) {
        this.user = user;
        this.loginTime = loginTime;
        this.loginIP = loginIP;
        initTokenId();
    }

    private void initTokenId(){
        String tokenId = UUID.randomUUID().toString().replaceAll("-","");
        this.tokenId = tokenId;
    }

    public JyUser getUser() {
        return user;
    }

    public void setUser(JyUser user) {
        this.user = user;
    }

    public String getTokenId() {
        return tokenId;
    }

    public void setTokenId(String tokenId) {
        this.tokenId = tokenId;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public String getLoginIP() {
        return loginIP;
    }

    public void setLoginIP(String loginIP) {
        this.loginIP = loginIP;
    }
}
